package com.zyl.edthresholdtraining.controller;

import com.zyl.edthresholdtraining.common.AppConstant;
import com.zyl.edthresholdtraining.service.UserTestResultService;
import com.zyl.edthresholdtraining.vo.BaseException;
import com.zyl.edthresholdtraining.vo.UserTestResultVO;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

/**
 * @author jiangtingfeng
 * @description
 * @date 2020/8/1/001
 */
@Controller
@RequestMapping(AppConstant.PROJECT_NAME+"/userTestResult")
public class UserTestResultController {

    @Autowired
    private UserTestResultService userTestResultService;
    @GetMapping("/get/{uuid}")
    @ApiModelProperty("内部直接调用")
    public String getUserTestResultVO(@PathVariable("uuid") String uuid, HttpServletRequest req, Model model) throws BaseException {
        UserTestResultVO timePartitionTotalAvg = userTestResultService.getTimePartitionTotalAvg(uuid, req);
        model.addAttribute("timePartitionTotalAvg",timePartitionTotalAvg);
        return "result";
    }

}
